﻿using Microsoft.AspNetCore.Components;
using PlatformUW.Entities.Dtos;
using PlatformUW.Entities.RequestFeatures;
using PlatformUW.Web.HttpRepository;

namespace PlatformUW.Web.Pages
{
    public partial class Players
    {
        public List<PlayerDto> PlayerList { get; set; } = new();

        public PagedMetaData MetaData { get; set; } = new();

        private readonly PlayerParameter _playerParameter = new PlayerParameter();

        [Inject]
        public IPlayerHttpRepository PlayerRepo { get; set; }

        protected override async Task OnInitializedAsync()
        {
            var pagingResponse = await PlayerRepo.GetPlayers(_playerParameter);
            PlayerList = pagingResponse.Items;
            MetaData = pagingResponse.MetaData;
        }
    }
}
